﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;
using Wolfut.MirageEE.Domain.CommonUtilities;

namespace Wolfut.MirageEE.Domain.Procurement
{
    /// <summary>
    /// 采购退货信息
    /// </summary>
    /// <remarks>
    /// Author: Bruce
    /// Date: 2009-03-14
    /// </remarks>
    [ActiveRecord("PURCHASE_GOODS_RETURNED_ORDERS")]
    public class POGoodsReturnOrder:PersistentObjectWithGuid
    {

        #region 退货单编号
        private string productReturnedBillCode = string.Empty;
        /// <summary>
        /// 退货单编号
        /// </summary>
        [Property("GOODS_RETURNED_BILL_CODE")]
        [ValidateIsUniqueInSameTransactionWithString(true, "数据库已经存在相同的退货单编号！")]
        [ValidateNonEmpty, ValidateLength(0, 100, "退货单编号超长！")]
        public virtual string ProductReturnedBillCode
        {
            get { return productReturnedBillCode; }
            set { productReturnedBillCode = value; }
        }
        #endregion

        #region 供应商
        private string supplierID = string.Empty;

        /// <summary>
        /// 供应商
        /// </summary>
        [Property("SUPPLIERS_ID")]
        [ValidateLength(0,100,"供应商ID超长")]
        public virtual  string SupplierID
        {
            get { return supplierID; }
            set { supplierID = value; }
        }
        #endregion

        #region 项目
        private string projectID = string.Empty;
        /// <summary>
        /// 项目
        /// </summary>
        [Property("PROJECTS_ID")]
        [ValidateLength(0, 100, "项目ID超长")]
        public virtual string ProjectID
        {
            get { return projectID; }
            set { projectID = value; }
        }
        #endregion        

        #region 日期
        private DateTime billDate ;
        /// <summary>
        /// 日期
        /// </summary>
        [Property("BILL_DATE")]
        public virtual DateTime BillDate
        {
            get { return billDate; }
            set { billDate = value; }
        }
        #endregion

        #region 币别代码
        private string currencyCode = string.Empty;

        /// <summary>
        /// 币别代码
        /// </summary>
        [Property("CURRENCY_CODE")]
        [ValidateLength(0, 40, "币别代码超长！")]
        public virtual string CurrencyCode
        {
            get
            {
                return currencyCode;
            }
            set
            {
                currencyCode = value;
            }
        }
        #endregion

        #region 送货地址
        private string deliverProductAddress = string.Empty;

        /// <summary>
        /// 送货地址
        /// </summary>
        [Property("DELIVER_GOODS_ADDRESS")]
        [ValidateLength(0, 100, "送货地址 超长！")]
        public virtual string DeliverProductAddress
        {
            get
            {
                return deliverProductAddress;
            }
            set
            {
                deliverProductAddress = value;
            }
        }
        #endregion

        #region 采购员
        private string purchaser = string.Empty;

        /// <summary>
        /// 采购员
        /// </summary>
        [Property("PURCHASER")]
        [ValidateLength(0, 100, "采购员超长！")]
        public virtual string Purchaser
        {
            get
            {
                return purchaser;
            }
            set
            {
                purchaser = value;
            }
        }
        #endregion

        #region 收货单号
        private string productReceiptCode = string.Empty;

        /// <summary>
        /// 收货单号
        /// </summary>
        [Property("GOODS_RECEIPT_CODE")]
        [ValidateLength(0, 100, "收货单号超长！")]
        public virtual string ProductReceiptCode
        {
            get
            {
                return productReceiptCode;
            }
            set
            {
                productReceiptCode = value;
            }
        }
        #endregion

        #region 供应商发票号
        private string inVoiceNo = string.Empty;

        /// <summary>
        /// 供应商发票号
        /// </summary>
        [Property("SUPPLIER_INVOICE_NUMBER")]
        [ValidateLength(0, 100, "供应商发票号超长！")]
        public virtual string InvoiceNo
        {
            get
            {
                return inVoiceNo;
            }
            set
            {
                inVoiceNo = value;
            }
        }
        #endregion

        #region 备注
        private string remark;
        /// <summary>
        /// 备注
        /// </summary>
        [Property("REMARKS")]
        [ValidateLength(0, 2000, "备注超长！")]
        public virtual string Remark
        {
            get
            {
                return remark;
            }
            set
            {
                remark = value;
            }
        }
        #endregion

        #region 账期
        [Property("CLOSING_PERIOD")]
        [ValidateRange(0, int.MaxValue, "不合法的帐期！")]
        public virtual int ClosingPeriod
        {
            get { return closingPeriod; }
            set { closingPeriod = value; }
        }

        private int closingPeriod;
        #endregion

        #region 折扣率
        /// <summary>
        /// 折扣率
        /// </summary>
        [Property("GOODS_RETURNED_DISCOUNT")]
        [ValidateRange(0, 100, "折扣率必须在0到100之间！")]
        public virtual decimal DiscountRate
        {
            get { return discountRate; }
            set { discountRate = value; }
        }
        private decimal discountRate;
        #endregion

        #region 收款方式
        private string paymentMethods = string.Empty;

        /// <summary>
        /// 收款方式
        /// </summary>
        [Property("PAYMENT_METHODS")]
        [ValidateLength(0, 100, "收款方式超长！")]
        public virtual string PaymentMethod
        {
            get
            {
                return paymentMethods;
            }
            set
            {
                paymentMethods = value;
            }
        }
        #endregion

        #region 收款条件
        private string paymentCondition = string.Empty;

        /// <summary>
        /// 收款条件
        /// </summary>
        [Property("PAYMENT_CONDITION")]
        [ValidateLength(0, 100, "收款条件超长！")]
        public virtual string PaymentCondition
        {
            get
            {
                return paymentCondition;
            }
            set
            {
                paymentCondition = value;
            }
        }
        #endregion

        #region 接收退款的账户
        private string refundmentAccount = string.Empty;

        /// <summary>
        /// 接收退款的账户
        /// </summary>
        [Property("REFUNDMENT_ACCOUNT")]
        [ValidateLength(0, 100, "接收退款的账户超长！")]
        public virtual string RrefundmentAccount
        {
            get
            {
                return refundmentAccount;
            }
            set
            {
                refundmentAccount = value;
            }
        }
        #endregion

        #region 本次退款
        private Decimal  currentRefundment;

        /// <summary>
        /// 本次退款
        /// </summary>
        [Property("CURRENT_REFUNDMENT")]
        public virtual Decimal CurrentRefundment
        {
            get
            {
                return currentRefundment;
            }
            set
            {
                currentRefundment = value;
            }
        }
        #endregion
        
        #region 退款状态
        private CollectingBillState refundmentState = CollectingBillState.NoCollectingBill;

        /// <summary>
        /// 退款状态
        /// </summary>
        [Property("REFUNDMENT_STATUS")]
        public virtual CollectingBillState RefundmentState
        {
            get
            {
                return refundmentState;
            }
            set
            {
                refundmentState = value;
            }
        }
        #endregion

        #region 制单人
        private string orderCreatedBy = string.Empty;

        /// <summary>
        /// 制单人
        /// </summary>
        [Property("ORDER_CREATED_BY")]
        [ValidateLength(0, 40, "制单人超长！")]
        public virtual string OrderCreatedBy
        {
            get
            {
                return orderCreatedBy;
            }
            set
            {
                orderCreatedBy = value;
            }
        }
        #endregion

        #region 凭证号
        private string voucherNo = string.Empty;

        /// <summary>
        /// 凭证号
        /// </summary>
        [Property("VOUCHER_NO")]
        [ValidateLength(0, 100, "凭证号超长！")]
        public virtual string VoucherNo
        {
            get
            {
                return voucherNo;
            }
            set
            {
                voucherNo = value;
            }
        }
        #endregion

        #region 逻辑删除
        private Boolean isDeleted;
        [Property("IS_DELETED")]
        public virtual Boolean IsDeleted
        {
            get
            {
                return isDeleted;
            }
            set
            {
                isDeleted = value;
            }
        }
        #endregion
        
    }
}
